package cn.ml.sboot11.controller;

import cn.ml.sboot11.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("test")
public class Test {
    @ResponseBody
    @GetMapping("ok")
    public String ok(){
        return "ok...";
    }

    @ResponseBody
    @RequestMapping("student/{sex}")
    public Student student(@PathVariable("sex") String sex){
        Student student = new Student();
        student.setName("马龙");
        student.setGender(sex);
        return student;
    }

}
